<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="提交界面.html">
        <p><label for="">用户名:</label><input type="text" name="user"></p>
        <p><label for="">密&emsp;码:</label><input type="text" name="pwd"></p>
        <p><label for="">手机号:</label><input type="text" name="phone"></p>
        <p><label for="">邮&emsp;箱:</label><input type="text" name="email"></p>
        <p><input type="submit" class="btn" value="注册"><input type="reset" value="取消"></p>
    </form>
</body>
<script>
    var btn = document.getElementsByClassName("btn")[0];

    btn.onclick = function () {
        // console.log(location.search);
        var submit = location.search;
        var qu = submit.slice(1, submit.length);
        var list = qu.split("&");
        // console.log(list);


        var obj = {};

        for (var i in list) {
            var index = list[i];
            var equal = index.split("=");
            obj[equal[0]] = decodeURIComponent(equal[1]);
        }
        /*  for (var i = 0; i < list.length; i++) {
             var index = list[i];
             var equal = index.split("=");
             obj[equal[0]] = decodeURIComponent(equal[1]);
         } */
        console.log(obj);
    }
</script>

</html>